Malloc Pointers and Stable Pointers: Improving Haskell's Foreign Language Interface

نویسنده

  • Alastair Reid
چکیده

The Glasgow Haskell compiler provides a foreign language interface which allows Haskell programs to call arbitrary C functions. This has been used both to implement the standard Haskell IO system and a variety of applications including an arcade game 8], and a graphical user interface to a database 19]. The theoretical problems associated with using impure functions from pure functional languages are avoided through the use of monads 17]; and the mismatch between strict languages with no garbage collection and lazy languages with garbage collection is tackled by unboxing (that is, forcing evaluation of arguments and stripping oo any header information) 15]. Whilst this works well for simple examples, it is unsuitable when one wants to pass arguments (or results) which are lazy, polymorphic or very large. We describe two extensions to the garbage collector which solve these problems by allowing better interaction between the Haskell garbage collector and memory allocation in the imperative world.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Unique Pointers: Performance, Burden, and Inference

Cyclone is an actively developed, type-safe, C-like programming language. Historically, language designers have either leaned toward safety or toward explicit memory management. Cyclone aims to provide the safety of a language like Java, while providing the control over data representation and memory management of low-level languages like C. Cyclone features a garbage-collected heap. However, g...

متن کامل

Montana Smart Pointers: They're Smart, and They're Pointers

The Montana C++ programming environment provides an API interface to the compiler, which allows the compilation process to be extended through programmer-supplied tools. This paper investigates the feasibility of that interface, using smart pointers as an example. Smart pointers are a powerful feature of the C++ language that enable a variety of applications, such as garbage collection, persist...

متن کامل

Synthesis of hardware models in C with pointers and complex data structures

One of the greatest challenges in a C/C++-based design methodology is efficiently mapping C/C++ models into hardware. Many networking and multimedia applications implemented in hardware or mixed hardware/software systems now use complex data structures stored in multiple memories, so many C/C++ features that were originally designed for software applications are now making their way into hardwa...

متن کامل

Applying Pointer Analysis to the Synthesis of Hardware from C a Dissertation Submitted to the Department of Electrical Engineering of Stanford University in Partial Fulfillment of the Requirements for the Degree of Doctor of Philosophy

With the advances in Computer Aided Design (CAD) technology, the design of digital circuits is becoming more and more as the development of software. Hardware is modeled using Hardware Description Languages (HDLs) very much as software is described using programming languages. Synthesis tools are used like compilers to map these HDL models into hardware. However, modern systems, which consist o...

متن کامل

A Portable C Interface for Standard ML of New Jersey

This paper describes the design and implementation of an interface to C for the SML/NJ ML compiler. The interface supplies ML datatypes with which programmers specify C types and C data. An ML program uses these datatypes to register a foreign C function with the interface and to build speci cations of structured C data. The interface automatically instantiates C function arguments from C data ...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1994